(1) Field of the Invention
The present invention relates to an apparatus and a method for coding moving pictures, for example, to a technology that is suitable when used in an apparatus employing the H.264 coding scheme.
(2) Description of Related Art
FIG. 7 is a block diagram showing the main configuration of an apparatus for coding moving pictures employing the H.264 coding scheme (H.264 encoder). The apparatus for coding moving pictures (hereinafter also referred to as simply a “coding apparatus”) shown in FIG. 7, includes an orthogonal transformer 310, a quantizer 320, an inverse quantizer 330, an inverse orthogonal transformer 340, a decoded picture generator (adder) 350, a decoded picture memory (frame memory) 360, a motion vector calculator 370, a prediction picture generator 380, an intra-prediction direction calculator 381, an intra-prediction picture generator 382, a cost comparator 383, a de-blocking filter (loop filter) 384, an intra/inter (intra-MB/inter-MB (MB is below-mentioned macro block)) switch 385, a prediction error signal generator (subtracter) 390, a coefficient entropy coder 400, a vector entropy coder 410, and a multiplexer (MUX) 420.
In the coding apparatus having such a configuration, a prediction error signal is generated at the prediction error generator 390 by detecting the difference between an original picture input (original picture signal) and a prediction picture signal generated by the prediction picture generator 380 (or the intra-prediction picture generator 382), and at the orthogonal transformer 310 after subjecting the prediction error signal to an orthogonal transformation (coefficient transformation) processing such as Discrete Cosine Transformation (DCT) by a macro block (MB) (element block) having a maximum block size of 16×16 pixels, the transformation coefficients are quantized using a quantization parameter (QP) at the quantizer 320.
Then the quantized results are subjected to entropy coding such as Huffman coding or arithmetic coding at the coefficient entropy coder 400, and multiplexed with the results of the entropy coding of motion vectors calculated by the motion vector calculator 370 on a multiplexer (MUX) 420 at the vector entropy coder 410 to be outputted.
At the same time, the quantized results by the quantizer 320 are also inputted into the inverse quantizer 330, inversely quantized at the inverse quantizer 330, and then inversely and orthogonally transformed at the inverse orthogonal transformer 340, thereby reproducing the prediction error signal. An original picture signal is reproduced by adding (combining) the reproduced prediction error signal and a picture signal generated by the prediction picture generator 380 (or the intra-prediction picture generator 382) at the decoded picture generator (adder) 350, and inputted into the intra-prediction direction calculator 381, the intra-prediction picture generator 382, the de-blocking filter 384, and the decoded picture memory 360, respectively, as reference picture signals for prediction coding.
In the intra-prediction direction calculator 381, based on the original picture signal; an input signal to the prediction error signal generator 390, and the reproduced original picture signal (hereinafter, also referred to as a decoded picture signal) reproduced (decoded) at the decoded picture generator 350, the intra-prediction (intra-MB prediction) direction is calculated (determined), and intra-prediction in the direction depending on the result is performed on the reproduced original picture signal at the intra-prediction picture generator 382 to generate an intra prediction picture signal.
Moreover, in the de-blocking filter 384, in order to reduce block noise (distortion) that has been a problem for a known algorithm for coding moving pictures, the decoded picture signal is subjected to a filtering processing by means of a low pass filter at block boundaries. In this manner, in H.264, since the de-blocking filter 384 is incorporated in a coding loop, a picture signal from which block noise is removed can be used as a reference picture signal for below-mentioned motion compensation prediction, and the effect of the block noise can be removed from the prediction error by mean of the motion compensation prediction to improve the efficiency of coding.
Further, at the prediction picture generator 380, based on a decoded picture signal (reference picture signal) stored in the decoded picture memory 360, and a motion vector calculated at the motion vector calculator 370, motion compensation prediction (inter-MB prediction) is performed to generate an (inter-MB) prediction picture signal.
In addition, depending on the result of the cost comparison at the cost comparator 383, by switching the intra-MB/inter-MB switch (hereinafter, simply referred to as the “switch”) 385, that is to say, by switching between an intra-prediction mode and an inter-prediction mode, any one of the inter-MB prediction picture signal and the above-mentioned intra-prediction picture signal is selectively outputted as a prediction picture signal used for detecting difference at the prediction error signal generator 390.
Here, the cost comparator 383 compares respective calculated results by the intra-prediction direction calculator 381 and the motion vector calculator 370 (for example, the absolute value of the difference between the original picture and the prediction picture in intra-prediction, and the absolute value of the difference between the original picture and the prediction picture in inter-prediction). Then, the cost comparator 383 switches the switch 385 (intra-prediction mode/inter-prediction mode) such that, when, if inter-MB prediction is used, the efficiency of coding is rather reduced due to loss of continuity as moving pictures in a mode of the smaller absolute value of the difference, that is, a scene change etc., the intra-prediction picture signal is selected as the reference picture signal for the prediction error signal generator 390, and on the contrary, when the motion compensation prediction is rather advantageous due to maintaining a continuity as moving pictures, the inter-MB prediction picture signal is selected as the reference picture signal for the prediction error signal generator 390.
Moreover, at the motion vector calculator 370, the motion vector is calculated by means of detection of the difference between the present (current picture) original picture signal and the past (former picture) decoded picture signal. (There are a progressive moving picture and an interlaced moving picture in moving pictures, and, in the interlaced moving picture, one frame is configured by two fields. At that time, the processing unit of coding can be selected from either a frame or a field. When the processing is performed by a frame (frame structure), one frame is called one picture, and when the processing is performed by a field (field structure), one field is called one picture. The coding is performed using a picture as a unit.)
In addition, as for another conventional apparatus for coding moving pictures, technologies suggested by the below-mentioned Patent Documents 1 and 2 are also present.
The technology disclosed in Patent Document 1 is one related to a video encoding/decoding for a color video, where an optimum encoding/decoding by color information is achieved by performing a first motion prediction on an input video, and then performing a second motion prediction, based on predetermined color components, on a prediction error video that is the predicted result of the first motion prediction.
The technology disclosed in Patent Document 2, is one related to encoding/decoding of a video containing a gray alpha channel, where respective blocks are classified into either a foreground region or a background region depending on the value of the gray alpha component contained in the block of picture data, the gray alpha component, brightness and the color degree component of the block contained in the foreground region are sequentially encoded, and the gray alpha component of the block contained in the background region is encoded.
Patent Document 1: Japanese Patent Application Laid-open No. 2005-39842
Patent Document 2: Japanese Patent Application Laid-open No. 2005-253088
In the H.264 standard, the filtering strength (coefficient) of the de-blocking filter 384 of a certain macro block (MB) is determined by the average of the quantized value (QP) of the DCT coefficient of the MB and the QP of the adjacent MB. However, the syntax of H.264 does not allow, when the prediction mode of the MB is not an intra-prediction mode (Intra—16×16) by means of the block size of 16×16 pixels, and the flag (CBP: Coded Block Pattern) indicating the presence of a non-zero DCT coefficient is 0, the QP of the MB to be coded. At that time, instead of the QP of the MB, the QP of the former MB is to be used for determining the filtering strength of the de-blocking filter 384.
Therefore, the QP used for quantizing the DCT coefficient of the MB may differ from the QP of the former (past) MB, whereby there is the case where filtering using the strength determined based on the QP of the former MB is not suitable. For example, as schematically shown in FIG. 8, when all of the DCT coefficients of the MB at a position shown by #B are zero, the filtering strength of the de-blocking filter 384 is to be determined using the QP of the former MB at a position shown by #A, which is far in a picture plane from, and may have a low statistical correlation with, the MB at the position of #B.
Moreover, when the input video is divided and encoded in parallel using a plurality of systems of encoder, the order of the MBs in a stream and the order of the MBs when coded may be exchanged in some cases. For example, as shown schematically in FIG. 9, when it is supposed to process the MBs (#1 to #40) in parallel using the four encoders designated by reference numerals A to D, each processing is to be started almost simultaneously from the MBs at #1, #11, #21, and #31.
At that time, when the MB at #11 is processed, the processing of the MB at #10 is not finished yet. That is, the order of MBs in the stream is from #10 to #11, however, the temporal order of processing in the encoder is reversed, i.e., from #11 to #10. Here, when all of the DCT coefficients of #11 at the encoder B are zero, the strength of the de-blocking filter 384 should be determined using the QP of #10, however, since at the time when the MBs of #11 are processed at the coder B, the QP for the MBs of #10 is not determined yet at the encoder A, it is not possible to determine the filtering strength of the de-blocking filter 384 with respect to #11.